#include <vector>
#include "../_share/release.hpp"
#ifndef _BTNODE_HPP_
#define _BTNODE_HPP_

#define BTNodePosi(T) BTNode<T>*

template <typename T>
struct BTNode {
	BTNodePosi(T) parent;
	std::vector<T> key;
	/* key[i]'s child is on child[i + 1] for right and on child[i] for left. */
	std::vector<BTNodePosi(T) > child;

	BTNode() {
		parent = NULL;
		child.insert(child.begin(), NULL);
	}

	BTNode(T e, BTNodePosi(T) lc = NULL, BTNodePosi(T) rc = NULL) {
		parent = NULL;
		key.insert(key.begin(), e);
		child.insert(child.begin(), lc);
		child.insert(child.begin() + 1, rc);
		if(lc) {
			lc->parent = this;
		}
		if(rc) {
			rc->parent = this;
		}
	}
};

#endif